-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Windows: Emulate MSG_PEEK by read #19777
Conversation
Commit Message: The way we implement i/o events on windows poses problems with peeking messages. The reason for that is that peeking does not drain the buffer which is an implicit requirement. This can cause slow clients to make envoy connections to hang. We solve this issue by implementing peek by draining the socket and storing the content of the socket to a buffer. Additional Description: See envoyproxy#17395 Risk Level: Medium Testing: Automated Docs Changes: Pending Release Notes: Pending Platform Specific Features: Windows only Co-authored-by: He Jie Xu <hejie.xu@intel.com> Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
Signed-off-by: He Jie Xu <hejie.xu@intel.com>
Signed-off-by: He Jie Xu <hejie.xu@intel.com>
Signed-off-by: He Jie Xu <hejie.xu@intel.com>
Signed-off-by: He Jie Xu <hejie.xu@intel.com>
Signed-off-by: He Jie Xu <hejie.xu@intel.com>
Signed-off-by: He Jie Xu <hejie.xu@intel.com>
Signed-off-by: He Jie Xu <hejie.xu@intel.com>
Signed-off-by: He Jie Xu <hejie.xu@intel.com>
Signed-off-by: He Jie Xu <hejie.xu@intel.com>
Signed-off-by: He Jie Xu <hejie.xu@intel.com>
Signed-off-by: He Jie Xu <hejie.xu@intel.com>
thanks @adisuissa give me the error info, and apologize for not making the code right. @adisuissa said there still other errors, appreciate if can help me spot them out, then let me fix it. |
// The length to copy should be size of smallest in the source slice available size and | ||
// the dest slice available size. | ||
uint64_t length_to_copy = | ||
std::min(left_data_size_in_src_slice, std::min(left_data_size_in_dst_slice, left_to_read)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I correct the length_to_copy
calculation.
dest_slice_offset = 0; | ||
} | ||
ASSERT(src_slice_offset <= src_slice.dataSize()); | ||
ASSERT(dest_slice_offset <= dest_slice.len_); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add two assertions for defending.
There is a fuzz error that seems to be in the fuzz test itself, and not due to this PR. |
got it, thanks |
/retest |
Retrying Azure Pipelines: |
@alyssawilk would you mind take a look at this pr again? Thanks in advance! |
tagging Adi for first pass since @wrowe has not been responding. |
Thanks! |
@davinci26 as much of this was your code, and we still have you on the assignable, envoy-triage and windows-dev teams, are you willing to take a pass at this? [If you would like us to modify your teams we can do that, too.] |
I will review later today |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
overall lgtm, thanks for all the hard work on this
test/extensions/filters/listener/proxy_protocol/proxy_protocol_test.cc
Outdated
Show resolved
Hide resolved
test/extensions/filters/listener/proxy_protocol/proxy_protocol_test.cc
Outdated
Show resolved
Hide resolved
Signed-off-by: He Jie Xu <hejie.xu@intel.com>
thanks! done the clean up for those useless logs in the tests. |
/retest |
Retrying Azure Pipelines: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for all your work on this!
Implementing peek by draining the socket and storing the
content of the socket to a buffer.
Additional Description: See #17395
Risk Level: Medium
Testing: Automated
Docs Changes: Pending
Release Notes: Pending
Platform-Specific Features: Windows only
Signed-off-by: He Jie Xu hejie.xu@intel.com
Co-authored-by: Sotiris Nanopoulos sonanopo@microsoft.com